package com.gdufs.secondhandwebsite.service.impl;

import com.gdufs.secondhandwebsite.dao.TagPostMapper;
import com.gdufs.secondhandwebsite.entity.TagPost;
import com.gdufs.secondhandwebsite.service.TagPostService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;


public class TagPostServiceImpl implements TagPostService {
    @Autowired
    TagPostMapper tagPostMapper;
    //    为帖子增加标签
    public void addTag(Long postId,String tagName){
        TagPost tagPost= new TagPost();
        tagPost.setPostId(postId);
        tagPost.setTagName(tagName);
        tagPostMapper.createTagPost(tagPost);
    }
     //    根据帖子的id获取它所有的标签
    public List<String> getTagByPostId(Long postId){
     return tagPostMapper.selectByPostId(postId);
    }
}
